<template>
  <el-dialog
    title="工单流转条件设置"
    :visible="visible"
    width="40%"
    @close="onClose"
  >
    <el-form :disabled="disabled" label-width="170px">
      <el-form-item
        :label="item.nodeName"
        v-for="item in localList"
        :key="item.nodeId"
      >
        <el-input v-model="item.link" placeholder="输入接口地址"> </el-input>
      </el-form-item>
    </el-form>
    <span slot="footer">
      <el-button @click="onClose">取 消</el-button>
      <el-button type="primary" @click="onConfirm">确 定</el-button>
    </span>
  </el-dialog>
</template>

<script>
import { cloneDeep } from "lodash";
export default {
  name: "SetActivityCondition",
  props: {
    visible: {
      type: Boolean,
      default: false,
    },
    list: {
      type: Array,
      default: () => [],
    },
    disabled: {
      type: Boolean,
      default: false,
    },
  },
  components: {},
  data() {
    return {
      localList: [],
    };
  },
  created() {},
  mounted() {},
  methods: {
    onClose() {
      this.$emit("update:visible", false);
      this.localList = cloneDeep(this.list);
    },
    onConfirm() {
      this.list.forEach((t, i) => {
        t.link = this.localList[i].link;
      });
      this.$emit("update:visible", false);
    },
  },
  watch: {
    list: {
      handler(val) {
        // console.log('val', val)
        this.localList = cloneDeep(val);
      },
      immediate: true,
    },
  },
  computed: {},
};
</script>

<style lang="scss" scoped></style>
